import request from '@/utils/request'

// 获取分页列表或根据条件查找返回的分页列表
export const reqUserAdminAsync = (page, limit, randbs) => {
  return request.get(`/admin/acl/user/${page}/${limit}?username=${randbs}&nickName${randbs}`)
}
// 添加平台用户
export const reqAddUserAdminItemAsync = (user) => {
  return request.post(`/admin/acl/user/save`, user)
}
// 修改平台用户信息
export const reqUpdateUserAdminItemAsync = (user) => {
  return request.put(`/admin/acl/user/update`, user)
}
// 删除平台用户信息
export const reqDeleteUserAdminItemAsync = (id) => {
  return request.delete(`/admin/acl/user/remove/${id}`)
}
// 批量删除平台用户信息
export const reqDeleteUserAdminListAsync = (idList) => {
  return request.delete(`/admin/acl/user/batchRemove`, {
    data: idList
  })
}
// 根据平台用户获取对应的角色信息以及能够分配的角色信息
export const reqGetUserAdminRoleAsync = (userId) => {
  return request.get(`/admin/acl/user/toAssign/${userId}`)
}
// 设置角色
export const reqPostUserAdminRoleAsync = (userId, roleId) => {
  return request.post(`/admin/acl/user/doAssign?userId=${userId}&roleId=${roleId}`)
}
